#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ElementType int
#define KeyType int
typedef struct{
    ElementType data;
    struct node *lchild,*rchild;
}BSTNode,*BiTree;
BSTNode *BST_Search(BiTree T,ElementType key){
    while (T!=NULL&&key!=T->data)
    {
        if(key<T->data) T=T->lchild;
        else{
            T=T->rchild;
        }
    }
    return T;
    
}
int BST_Insert(BiTree &T,KeyType k){
    if(T==NULL){
        T=(BiTree)malloc(sizeof(BSTNode));
        T->data=k;
        T->lchild=T->rchild=NULL;
        return 1;
    }
    else if(k==T->data){
        return 0;
    }else if (k<T->data)
    {
        return BST_Insert(T->lchild,k);
    }else 
        return BST_Insert(T->rchild,k);
    
}
void Creat_BST(BiTree &T,KeyType str[],int n){
    T=NULL;
    int i=0;
    while(i<n){
        BST_Insert(T,str[i]);
        i++;
    }
}